﻿using AbpProjectTemplate.Domain.Users;
using System.Collections.Generic;
using System.Linq;

namespace AbpProjectTemplate.Application
{
    /// <summary>
    /// 管理员授权
    /// </summary>
    public class ManagerAuthorizeAttribute : AppAuthorizeAttribute
    {
        public ManagerAuthorizeAttribute(params object[] permissions)
            : base(                  //如果指定了权限，则不需要设置AS.Permissions.WebMember的基础权限
                  (permissions.Any()
                        ? new List<object>(permissions) { }
                        : new List<object>() { UserType.Admin }
                        ).ToArray()
              )
        {
            //this.RequireAllPermissions = true;
        }
    }
}

